<template>
  <div v-if="viewModel">
    <el-form-item :label="title+'奖励资产类别'">
      <x-select type="moneyTypeConfig" v-model="viewModel.moneyTypeId"></x-select>
      <div class="sale-intro">用户{{title}}时，获取奖励的资产账号</div>
    </el-form-item>
    <el-form-item :label="title+'最小奖励'">
      <el-input-number :min="0" :max="10000" v-model="viewModel.minAmount"></el-input-number>
      <div class="sale-intro">用户{{title}}时，随机得到的最小奖励。 若需要固定奖励可将最大值和最小值设置成一样</div>
    </el-form-item>
    <el-form-item :label="title+'最大奖励'">
      <el-input-number :min="0" :max="10000" v-model="viewModel.maxAmount"></el-input-number>
      <div class="sale-intro">用户{{title}}时，随机得到的最小奖励。 若需要固定奖励可将最大值和最小值设置成一样</div>
    </el-form-item>
  </div>
</template>
<script>
  import ala from 'ala'
  export default {
    model: {
      prop: 'dataModel',
      event: 'change'
    },
    props: {
      dataModel: {},
      title: {}
    },
    data () {
      return {
        viewModel: null,
        dialogVisible: false
      }
    },
    mounted () {
      this.init()
    },
    methods: {
      async init () {
        this.viewModel = this.dataModel
      }
    },
    watch: {
      viewModel: {
        deep: true,
        handler (val) {
          this.$emit('change', this.viewModel)
        }
      }
    }
  }
</script>
